package com.srit.recipes.entity;

import com.alibaba.fastjson.annotation.JSONField;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.annotation.CreatedDate;
import org.springframework.data.annotation.LastModifiedDate;
import org.springframework.data.jpa.domain.support.AuditingEntityListener;
import org.springframework.format.annotation.DateTimeFormat;

import javax.persistence.*;
import java.util.Date;

@Table
@Entity
@Getter
@Setter
@EntityListeners(AuditingEntityListener.class)
public class InventoryHis extends RecipesId {

    public static final int IN = 0;
    public static final int OUT = 1;

    @CreatedDate
    @Column(nullable = false,columnDefinition = " datetime comment '创建时间'",updatable = false)
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    protected Date createTime;

    private String name;

    private Long wight;

    private String unit;

    @Column
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date expiration;

    /**
     * 批次号
     */
    private String batch;

    private String distributor;

    private int type;

    private String originArea;

    private String logistics;

    private String saveTraceCode;

    private Double price;

    @Transient
    @DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
    private Date endTime;


}
